import {connect} from "react-redux"
import {increment, decrement} from '../../redux/actions/count'
import { bindActionCreators } from 'redux'
function Counter ({count, increment, decrement}) {
    console.log(count)

    return (
      <div>
        <button onClick={() => increment(3)}>+</button>
        <span>{count.count}</span>
        <button onClick={() => decrement(3)}>-</button>
      </div>
    );
  }
 const mapDispatchToProps = (dispatch, ownProps) => {
    return {
      // increment: () => {
      //   dispatch({type:'increment'})
      // }
      ...bindActionCreators({increment, decrement}, dispatch)
    }
  }


  export default connect((state) => ({count:state.count}), mapDispatchToProps)(Counter)